package com.hometeacher.api.util;

import lombok.*;
import org.springframework.stereotype.Component;

import java.util.LinkedHashMap;
import java.util.List;


@Component
public class Json {

    private boolean success = true;// 是否成功
    private String errorCode = "-1";//错误代码
    private String msg = "succeed";// 提示信息
    private Integer status = 200;// 提示信息
    private LinkedHashMap<String, Object> result;
    LinkedHashMap<String, Object> data;
//    输入数据的名字 和 数据的map，传回 带参数的map数据 如下
//    {
//  "success": true,
//  "data": {
//    "teacherList": [
//      {
//        "id": 1,
//        "teacherID": "1",
//        "teacherName": "李哈哈",
//        "teacherSex": "男",
//      }
//    ]
//  }
//    }
    public LinkedHashMap<String, Object> getJson(String dataName , Object data ) {
        this.result = new LinkedHashMap<String, Object>();
        this.data = new LinkedHashMap<String, Object>();

        this.data.put(dataName,data);
        result.put("success",success);
        result.put("data",this.data);

        return result;
    }


}
